Introduction to Spatial Data Visualisation

Tatiana Proboste

School of Veterinary Science, University of Queensland

2023-11-20

Introduction

  • This introduction to spatial visualisation assumes that you are familiar with R and Rstudio.

  • This session will have a very brief introduction and most of the session will be for you to practice.

  • I am a Veterinarian working in epidemiology - R is my favorite software and I will try to convince you that it is worth the effort.

  • If you have any questions, please don’t hesitate to ask. We are all here to learn.

Why in R

  • Because R is free

  • Repeatable - It is easy to repeat analysis

  • Sharing - it is easy to share the code with collaborators

  • Working with teams - It is possible to work on the same analysis/project with multiple collaborators.

  • Internet is full of tutorials and helps on how to conduct analysis in R

Where to start

All the information for this session is on GitHub

I designed the tutorial so you can download most of the data using a package or from open sources.

Package

The sf package (Pebesma, E., 2022) stands for Simple Features.

This package replaces sp and allows us to treat spatial objects like shape file objects as regular data frames!

What are the advantages of this package:

  • Fast reading and writing of data objects

  • Enhanced plotting performance

  • sf objects can be treated as data frames in most operations

  • sf functions can be combined using %>% operator

Simple Features classes

Simple Features: Cheat Sheet

Example of what we can do with sf and mapview

This map is an example of the maps we can create with R

example from Paula Moraga, 2023

Package

  • terra package (Hijmans 2023) replaces the raster package.

  • It is faster, simple and can do more

Example of a raster using terra

What we will learn

  • Accessing open data
  • Transformations, CRS, extraction, calculation
  • Spatial data wrangling

References

https://bookdown.org/robinlovelace/geocompr/ https://github.com/rstudio/cheatsheets/blob/main/sf.pdf https://www.paulamoraga.com/book-spatial/types-of-spatial-data.html